<?php
use Illuminate\Support\Facades\Auth;
return [
    'title'=>'站点设置',
    'permission'=>function(){
        return Auth::user()->hasRole('Founder');
    },
    'edit_fields'=>[
        'site_name'=>[
            'title'=>'站点名称',
            'type'=>'text',
            'limit'=>50
        ],
        'contact_email'=>[
            'title'=>'联系人邮箱',
            'type'=>'text',
            'limit'=>50
        ],
        'seo_description'=>[
            'title'=>'SEO -Description',
            'type'=>'textarea',
            'limit'=>250
        ],
        'seo_keywords'=>[
            'title'=>'SEO -Keywords',
            'type'=>'textarea',
            'limit'=>250
        ]
    ],
    'rules'=>[
        'site_name'=>'required|max:50',
        'contact_email'=>'email'
    ],
    'messages'=>[
        'site_name.required'=>'请填写站点名称',
        'contact_email.email'=>'联系人邮箱不正确'
    ],
    'before_save'=>function(&$data){
        if(!strpos($data['site_name'],'Powder By Luntan2') === false){
            $data['site_name'] .= $data['site_name'].' - Powder By Luntan2';
        }
    },
    'actions'=>[
        'clear_cache'=>[
            'title'=>'清理缓存',
            'messages'=>[
                'active'=>'正在清理缓存...',
                'success'=>'缓存清理成功',
                'error'=>'清空缓存出错'
            ],
            'action'=>function(&$data){
                \Illuminate\Support\Facades\Artisan::call('cache:clear');
                return true;
            }
        ]
    ]

];
